home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / misc / at.sty < prev    next >
Text File  |  1993-07-07  |  2KB  |  53 lines

  1. % at.sty     Colin Hogben (chah@jet.uk)
  2. % 12-Aug-91  First version
  3. % 20-Mar-92  Fixed to allow for \headheight
  4. % 06-Jul-93  \@useat only used in case of any \at material (B.Gaulle)
  5. %
  6. % \at(HPOS,VPOS){TEXT}
  7. % Positions TEXT at an absolute distance of HPOS from the left edge
  8. % and VPOS from the top edge of the current page.
  9. %
  10. % Example:
  11. %   \at(2cm,5cm){\parbox[t]{10cm}{
  12. %       Name\\          % Recipient's name and address positioned
  13. %       Address\\etc.}} % suitably for a windowed envelope
  14. % -----------------------------------------------------------------
  15. %
  16. % First create a box in which to store absolute positioned material.
  17. %
  18. \newbox\@atbox
  19. \newif\ifat\atfalse% --bg
  20. %
  21. % at(HPOS,VPOS){TEXT}
  22. % Add the TEXT to the box with suitable offsets applied.
  23. %
  24. \long\def\at(#1,#2)#3{\setbox\@atbox=\hbox
  25.  {\unhbox\@atbox
  26.   \vtop to 0pt{\kern #2\hbox to 0pt{\kern #1\relax #3\hss}\vss}}%
  27.  \attrue}% --bg
  28. %
  29. % Unload the saved absolute-positioned material.
  30. % Teleport to the actual top corner of the page by undoing the header
  31. % separation, the top and side margins, and the mysterious 1 inch
  32. % offset applied to each. Then make it look like a singularity (zero
  33. % height, depth and width).
  34. %
  35. \def\@useat{\ifat% --bg
  36.   \vtop to 0pt{\kern-\headsep \kern-\topmargin \kern-\headheight \kern-1in
  37.     \hbox to 0pt{\kern-\@themargin \kern-1in \unhbox\@atbox \hss}\vss}%
  38.             \fi\atfalse}% --bg
  39. %
  40. % The following is a copy of the latex.tex \output routine except for
  41. % line 1: this prepends the shifted absolute material to the current
  42. % page. A little unsafe to copy code like this, but I couldn't work
  43. % out where else to insert the box.
  44. %
  45. \output{\setbox255=\vbox{\@useat \unvbox255}%
  46.   \ifnum\outputpenalty <-\@M\@specialoutput\else%
  47.   \@makecol\@opcol\@floatplacement\@startcolumn%
  48.   \@whilesw\if@fcolmade \fi{\@opcol\@startcolumn}\fi%
  49.   \global\vsize\ifnum\outputpenalty >-\@Miv \@colroom%
  50.                   \else \maxdimen\fi}%
  51. %
  52. \endinput% --bg
  53.